#ifndef _myDES_H
#define _myDES_H
#include "common.h"
#include <stdio.h>

class myDES
{
public:
	myDES();
    ~myDES();
     void ByteToBit(bool *Out, const char *In, int bits);
     void BitToByte(char *Out, const bool *In, int bits);
     void RotateL(bool *In, int len, int loop);
     void RotateR(bool *In,int len,int loop);
     void Xor(bool *InA, const bool *InB, int len);
     void Transform(bool *Out, bool *In, const char *Table, int len);
     void S_func(bool Out[32], const bool In[48]);
     void F_func(bool In[32], const bool Ki[48]);
     bool RunDes(bool bType,char* In,char* Out,unsigned datalen,const char* Key,const unsigned char keylen);
     bool RunPad(int nType,const char* In,unsigned datalen,char* Out,unsigned& padlen);
     void SetSubKey(PSubKey pSubKey, const char Key[8]);
     void DES(char Out[8], char In[8], const PSubKey pSubKey,bool nType);
     bool myRunDES(bool bType,char* In,char* Out,unsigned datalen,const char* Key,const unsigned char keylen);
};
#endif